home *** CD-ROM | disk | FTP | other *** search
/ GFX Sensations 1 / Graphic Sensations - Volume 1.iso / tools / amiga / 3d_tools / irit40s.lha / Irit / misc_lib / miscattr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-30  |  2.1 KB  |  68 lines

  1. /*****************************************************************************
  2. * Setting attributes for objects.                         *
  3. *                                         *
  4. * Written by:  Gershon Elber                Ver 0.2, Mar. 1990   *
  5. *****************************************************************************/
  6.  
  7. #ifndef MISCATTR_H
  8. #define MISCATTR_H
  9.  
  10. #include "irit_sm.h"
  11.  
  12. typedef enum {
  13.     IP_ATTR_NONE,
  14.     IP_ATTR_INT,
  15.     IP_ATTR_REAL,
  16.     IP_ATTR_STR,
  17.     IP_ATTR_OBJ,
  18.     IP_ATTR_PTR
  19. } IPAttributeType;
  20.  
  21. #define IP_ATTR_BAD_INT        -32767
  22. #define IP_ATTR_BAD_REAL    1e30
  23. #define IP_ATTR_NO_COLOR    999
  24.  
  25. /*****************************************************************************
  26. * Attributes - an attribute has a name and can be one of the following:         *
  27. * an integer, real, string, or a pointer to an Object.                 *
  28. *****************************************************************************/
  29. typedef struct IPAttributeStruct {
  30.     struct IPAttributeStruct *Pnext;
  31.     char *Name;
  32.     IPAttributeType Type;
  33.     union {
  34.     char *Str;
  35.        int I;
  36.     RealType R;
  37.     struct IPObjectStruct *PObj;
  38.     VoidPtr Ptr;
  39.     } U;
  40. } IPAttributeStruct;
  41.  
  42. void AttrSetIntAttrib(IPAttributeStruct **Attrs, char *Name, int Data);
  43. int AttrGetIntAttrib(IPAttributeStruct *Attrs, char *Name);
  44.  
  45. void AttrSetRealAttrib(IPAttributeStruct **Attrs, char *Name, RealType Data);
  46. RealType AttrGetRealAttrib(IPAttributeStruct *Attrs, char *Name);
  47.  
  48. void AttrSetPtrAttrib(IPAttributeStruct **Attrs, char *Name, VoidPtr Data);
  49. VoidPtr AttrGetPtrAttrib(IPAttributeStruct *Attrs, char *Name);
  50.  
  51. void AttrSetStrAttrib(IPAttributeStruct **Attrs, char *Name, char *Data);
  52. char *AttrGetStrAttrib(IPAttributeStruct *Attrs, char *Name);
  53.  
  54. IPAttributeStruct *AttrTraceAttributes(IPAttributeStruct *TraceAttrs);
  55. char *Attr2String(IPAttributeStruct *Attr);
  56.  
  57. void AttrResetAttributes(IPAttributeStruct **Attrs);
  58.  
  59. void AttrFreeOneAttribute(IPAttributeStruct **Attrs, char *Name);
  60. void AttrFreeAttributes(IPAttributeStruct **Attrs);
  61.  
  62. IPAttributeStruct *AttrFindAttribute(IPAttributeStruct *Attrs, char *Name);
  63.  
  64. IPAttributeStruct *_AttrMallocAttribute(char *Name, IPAttributeType Type);
  65. void _AttrFreeAttributeData(IPAttributeStruct *Attr);
  66.  
  67. #endif /* MISCATTR_H */
  68.